"""
@name : test01
@author : maxueyan
@projectname: sanchuang
"""

import requests
import re

response = requests.get('https://www.sanchuangedu.cn/')
response.encoding = 'utf-8'
msg = response.text
#获取网页
image_list = re.findall(r"(?<=img src=\").+(?:jpg|png)",msg)
#通过正则表达式来获取图片信息
# print(image_list)
a = 1
for i in image_list:
    ip = 'https://www.sanchuangedu.cn/'+i
    result = requests.get(ip)
    dir = '图片'+ str(a) + '.jpg'
    #保存图片名称
    fp = open(dir,'wb')
    fp.write(result.content)
    a += 1
print("下载成功！")



